home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 1490 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  856 b 

  1. From: Namic@msn.com (The ugly pink sweater book The Orange book is)
  2. Subject: Dumb Question? about ptr
  3. Date: 10 Jan 96 23:10:12 -0800
  4. Message-ID: <00001a81+00008b8f@msn.com>
  5. Path: news.msn.com!msn.com
  6. Newsgroups: comp.lang.c++
  7. Organization: The Microsoft Network (msn.com)
  8.  
  9. Dont laugh im only been programming in this for a few hours but why is
  10. this giving me the following errors in Line 11 (I copied straight out 
  11. o a how to program in C++ book. Yes the compilers match i have 
  12. Borland C++ 4.02 
  13.  
  14. Error NONAME00.CPP 11: Type name expected
  15. Error NONAME00.CPP 11: Variable 'foo' is initialized more than once
  16. Error NONAME00.CPP 11: Improper use of typedef 'MyStruct'
  17.                     
  18.  
  19. #include <iostream.h>                    
  20.  
  21. class MyStruct {
  22.     public:
  23.     int data;
  24.     int value;
  25. };
  26.  
  27. MyStruct *foo;
  28. MyStruct Record1;
  29. foo = &MyStruct;
  30.  
  31. void main() {
  32.     foo->data=5;
  33.     cout << foo->data;
  34. };
  35.